<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: Api::V3::LikesController
  
    &mdash; Ruby China API 文档
  
</title>

  <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  pathId = "Api::V3::LikesController";
  relpath = '../../';
</script>


  <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../../class_list.html"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../../_index.html">Index (L)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../../Api.html" title="Api (module)">Api</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../V3.html" title="Api::V3 (module)">V3</a></span></span>
     &raquo; 
    <span class="title">LikesController</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <iframe id="search_frame" src="../../class_list.html"></iframe>

      <div id="content"><h1>Class: Api::V3::LikesController
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName"><span class='object_link'><a href="ApplicationController.html" title="Api::V3::ApplicationController (class)">ApplicationController</a></span></span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ActionController::API</li>
          
            <li class="next"><span class='object_link'><a href="ApplicationController.html" title="Api::V3::ApplicationController (class)">ApplicationController</a></span></li>
          
            <li class="next">Api::V3::LikesController</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>app/controllers/api/v3/likes_controller.rb</dd>
  </dl>
  
</div>








  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#create-instance_method" title="#create (instance method)">#<strong>create</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>赞一个信息.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#destroy-instance_method" title="#destroy (instance method)">#<strong>destroy</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>取消之前的赞.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods inherited from <span class='object_link'><a href="ApplicationController.html" title="Api::V3::ApplicationController (class)">ApplicationController</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="ApplicationController.html#admin%3F-instance_method" title="Api::V3::ApplicationController#admin? (method)">#admin?</a></span>, <span class='object_link'><a href="ApplicationController.html#can%3F-instance_method" title="Api::V3::ApplicationController#can? (method)">#can?</a></span>, <span class='object_link'><a href="ApplicationController.html#current_ability-instance_method" title="Api::V3::ApplicationController#current_ability (method)">#current_ability</a></span>, <span class='object_link'><a href="ApplicationController.html#current_user-instance_method" title="Api::V3::ApplicationController#current_user (method)">#current_user</a></span>, <span class='object_link'><a href="ApplicationController.html#error%21-instance_method" title="Api::V3::ApplicationController#error! (method)">#error!</a></span>, <span class='object_link'><a href="ApplicationController.html#error_404%21-instance_method" title="Api::V3::ApplicationController#error_404! (method)">#error_404!</a></span>, <span class='object_link'><a href="ApplicationController.html#optional%21-instance_method" title="Api::V3::ApplicationController#optional! (method)">#optional!</a></span>, <span class='object_link'><a href="ApplicationController.html#requires%21-instance_method" title="Api::V3::ApplicationController#requires! (method)">#requires!</a></span></p>

  

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="create-instance_method">
  
    #<strong>create</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>赞一个信息</p>

<p>POST /api/v3/likes</p>

<h2 id="label-returns">returns</h2>
<ul><li>
<p>count [Integer] 已赞的数量</p>
</li></ul>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>obj_type</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>类型 [topic, reply]</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>obj_id</span>
      
      
        <span class='type'>(<tt>Integer</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>对应数据的编号</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


20
21
22
23
24</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/controllers/api/v3/likes_controller.rb', line 20</span>

<span class='kw'>def</span> <span class='id identifier rubyid_create'>create</span>
  <span class='id identifier rubyid_current_user'>current_user</span><span class='period'>.</span><span class='id identifier rubyid_like'>like</span><span class='lparen'>(</span><span class='id identifier rubyid_likeable'>likeable</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>obj_type:</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:obj_type</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>obj_id:</span> <span class='id identifier rubyid_likeable'>likeable</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='id identifier rubyid_likeable'>likeable</span><span class='period'>.</span><span class='id identifier rubyid_likes_count'>likes_count</span> <span class='rbrace'>}</span>
  <span class='id identifier rubyid_render'>render</span> <span class='label'>json:</span> <span class='id identifier rubyid_data'>data</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="destroy-instance_method">
  
    #<strong>destroy</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>取消之前的赞</p>

<p>DELETE /api/v3/likes</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>obj_type</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>类型 [topic, reply]</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>obj_id</span>
      
      
        <span class='type'>(<tt>Integer</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>对应数据的编号</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


32
33
34
35
36</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/controllers/api/v3/likes_controller.rb', line 32</span>

<span class='kw'>def</span> <span class='id identifier rubyid_destroy'>destroy</span>
  <span class='id identifier rubyid_current_user'>current_user</span><span class='period'>.</span><span class='id identifier rubyid_unlike'>unlike</span><span class='lparen'>(</span><span class='id identifier rubyid_likeable'>likeable</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>obj_type:</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:obj_type</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>obj_id:</span> <span class='id identifier rubyid_likeable'>likeable</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='label'>count:</span> <span class='id identifier rubyid_likeable'>likeable</span><span class='period'>.</span><span class='id identifier rubyid_likes_count'>likes_count</span> <span class='rbrace'>}</span>
  <span class='id identifier rubyid_render'>render</span> <span class='label'>json:</span> <span class='id identifier rubyid_data'>data</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Thu Oct 20 19:35:16 2016 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.5 (ruby-2.3.1).
</div>

    </div>
  </body>
</html>